package org.jim.server.demo.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

/**
 * <p>
 * 即时通讯消息表
 * </p>
 *
 * @author lml
 * @since 2025-03-25
 */
@TableName("im_message")
public class ImMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 消息ID，自增主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @JSONField(deserialize = false)
    private Long id;

    /**
     * 来源用户ID
     */
    private String froms;

    /**
     * 目标用户ID/群ID
     */
    private String to;

    /**
     * 命令码(11)int类型
     */
    private Integer cmd;

    /**
     * 消息创建时间，long类型时间戳
     */
    private Long createTime;

    /**
     * 消息类型(0:text、1:image、2:voice、3:video、4:music、5:news)
     */
    private Integer msgType;

    /**
     * 聊天类型(0:未知,1:公聊,2:私聊)
     */
    private Integer chatType;

    /**
     * 群组ID，仅在chatType为1时需要
     */
    private String groupId;

    /**
     * 消息内容
     */
    private String content;

    /**
     * 扩展字段，JSON格式
     */
    private String extras;

    /**
     * 消息状态(0:未读,1:已读,2:撤回)
     */
    private Integer status;

    /**
     * 是否删除(0:否,1:是)
     */
    private Boolean isDel;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFrom() {
        return froms;
    }

    public void setFrom(String from) {
        this.froms = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public Integer getCmd() {
        return cmd;
    }

    public void setCmd(Integer cmd) {
        this.cmd = cmd;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Integer getMsgType() {
        return msgType;
    }

    public void setMsgType(Integer msgType) {
        this.msgType = msgType;
    }

    public Integer getChatType() {
        return chatType;
    }

    public void setChatType(Integer chatType) {
        this.chatType = chatType;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getExtras() {
        return extras;
    }

    public void setExtras(String extras) {
        this.extras = extras;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Boolean getDel() {
        return isDel;
    }

    public void setDel(Boolean del) {
        isDel = del;
    }

    @Override
    public String toString() {
        return "ImMessage{" +
                "id=" + id +
                ", from='" + froms + '\'' +
                ", to='" + to + '\'' +
                ", cmd=" + cmd +
                ", createTime=" + createTime +
                ", msgType=" + msgType +
                ", chatType=" + chatType +
                ", groupId='" + groupId + '\'' +
                ", content='" + content + '\'' +
                ", extras='" + extras + '\'' +
                ", status=" + status +
                ", isDel=" + isDel +
                '}';
    }
}
